package link.xieyu.mapper;

import java.util.List;
import link.xieyu.pojo.AppOrder;
import org.apache.ibatis.annotations.Param;

public interface AppOrderMapper {
    /**
     * delete by primary key
     *
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * insert record to table
     *
     * @param record the record
     * @return insert count
     */
    int insert(AppOrder record);

    int insertOrUpdate(AppOrder record);

    int insertOrUpdateSelective(AppOrder record);

    /**
     * insert record to table selective
     *
     * @param record the record
     * @return insert count
     */
    int insertSelective(AppOrder record);

    /**
     * select by primary key
     *
     * @param id primary key
     * @return object by primary key
     */
    AppOrder selectByPrimaryKey(Integer id);

    /**
     * update record selective
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(AppOrder record);

    /**
     * update record
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(AppOrder record);

    int updateBatch(List<AppOrder> list);

    int updateBatchSelective(List<AppOrder> list);

    int batchInsert(@Param("list") List<AppOrder> list);

    AppOrder findOneByUserIdAndArticleId(@Param("userId") Integer userId, @Param("articleId") Integer articleId);

    AppOrder findOneByUserIdAndArticleIdAndIsPay(@Param("userId") Integer userId, @Param("articleId") Integer articleId,
                                                 @Param("isPay") Integer isPay);

    Integer countByUserIdAndArticleIdAndIsPay(@Param("userId") Integer userId, @Param("articleId") Integer articleId,
                                              @Param("isPay") Integer isPay);

    int updateByUserIdAndArticleId(@Param("updated") AppOrder updated, @Param("userId") Integer userId,
                                   @Param("articleId") Integer articleId);
}